package javabase.schoolwork.day6_19;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

/**
 * @author fance
 * @date 2018/6/19 21:10
 */
public class UDPServer {
    public static void main(String[] args) throws IOException {
        DatagramSocket datagramSocket = null;
        DatagramPacket datagramPacket = null;

        datagramSocket = new DatagramSocket(3000);

        String s = "hello ";
        datagramPacket = new DatagramPacket(
                s.getBytes(),s.length(),
                InetAddress.getByName("localhost"),
                9000
        );
        datagramSocket.send(datagramPacket);
        datagramSocket.close();
    }
}
